local hide = CreateFrame("Frame", nil, UIParent)

Diablo3dynOrbs = {}

hide:RegisterEvent("PLAYER_LOGIN")

hide:SetScript("OnEvent", function ()

  if(event=="PLAYER_LOGIN") then
  
    if(not Diablo3dynOrbs.art) then Diablo3dynOrbs.art = 1 end
    if(not Diablo3dynOrbs.bar) then Diablo3dynOrbs.bar = 1 end
    if(not Diablo3dynOrbs.coordx) then Diablo3dynOrbs.coordx = 0 end
    if(not Diablo3dynOrbs.coordy) then Diablo3dynOrbs.coordy = 0 end
    if(not Diablo3dynOrbs.scale) then Diablo3dynOrbs.scale = 1 end
  
    hide:create_d3artframe1()
    hide:create_d3artframe2()
    hide:create_bottomframeleft()
    hide:create_bottomframeright()
    hide:create_bottomframemiddle()
    hide:create_d3barframe()
  end 

end)

  function hide:create_d3artframe1()
    local f = CreateFrame("Frame","D3AngelFrame",UIParent)
    f:SetFrameStrata("BACKGROUND")
    f:SetFrameLevel(8)
    f:SetWidth(160)
    f:SetHeight(160)
    local t = f:CreateTexture(nil,"BACKGROUND")
    t:SetTexture("Interface\\Addons\\Diablo3dynOrbs\\d3_angel")
    t:SetAllPoints(f)
    f.texture = t
    f:SetPoint("BOTTOM",335,0)
    if Diablo3dynOrbs.art == 1 then
        D3AngelFrame:Show()
    else
        D3AngelFrame:Hide()
    end
  end
  
  function hide:create_d3artframe2()
    local f = CreateFrame("Frame","D3DemonFrame",UIParent)
    f:SetFrameStrata("BACKGROUND")
    f:SetFrameLevel(8)
    f:SetWidth(160)
    f:SetHeight(160)
    local t = f:CreateTexture(nil,"BACKGROUND")
    t:SetTexture("Interface\\Addons\\Diablo3dynOrbs\\d3_demon")
    t:SetAllPoints(f)
    f.texture = t
    f:SetPoint("BOTTOM",-350,0)
    if Diablo3dynOrbs.art == 1 then
        D3DemonFrame:Show()
    else
        D3DemonFrame:Hide()
    end
  
  end
  
  function hide:create_d3barframe()
    local f = CreateFrame("Frame","D3BarFrame",UIParent)
    f:SetFrameStrata("BACKGROUND")
    f:SetFrameLevel(5)
    f:SetWidth(662)
    f:SetHeight(256)
    local t = f:CreateTexture(nil,"BACKGROUND")
    t:SetTexture("Interface\\Addons\\Diablo3dynOrbs\\d3_bar4")
    t:SetAllPoints(f)
    f.texture = t
    f:SetPoint("BOTTOM",0,11)
       if Diablo3dynOrbs.bar == 1 then
        D3BarFrame:Show()
    else
        D3BarFrame:Hide()
    end
  end
  
  function hide:create_bottomframeleft()
    local f = CreateFrame("Frame",nil,UIParent)
    f:SetFrameStrata("BACKGROUND")
    f:SetFrameLevel(7)
    f:SetWidth(128)
    f:SetHeight(56)
    local t = f:CreateTexture(nil,"BACKGROUND")
    t:SetTexture("Interface\\Addons\\Diablo3dynOrbs\\d3_bottom_left")
    t:SetAllPoints(f)
    f.texture = t
    f:SetPoint("BOTTOM",-310,-3)
    f:Show()
  end
  
function hide:create_bottomframeright()
    local f = CreateFrame("Frame",nil,UIParent)
    f:SetFrameStrata("BACKGROUND")
    f:SetFrameLevel(7)
    f:SetWidth(128)
    f:SetHeight(56)
    local t = f:CreateTexture(nil,"BACKGROUND")
    t:SetTexture("Interface\\Addons\\Diablo3dynOrbs\\d3_bottom_right")
    t:SetAllPoints(f)
    f.texture = t
    f:SetPoint("BOTTOM",310,-3)
    f:Show()
  end
  
  function hide:create_bottomframemiddle()
    local f = CreateFrame("Frame",nil,UIParent)
    f:SetFrameStrata("BACKGROUND")
    f:SetFrameLevel(6)
    f:SetWidth(512)
    f:SetHeight(56)
    local t = f:CreateTexture(nil,"BACKGROUND")
    t:SetTexture("Interface\\Addons\\Diablo3dynOrbs\\d3_bottom_middle")
    t:SetAllPoints(f)
    f.texture = t
    f:SetPoint("BOTTOM",0,-3)
    f:Show()
  end